subroutine alloc_profile_table(p,n)
  use table_param,only:total_alloc_event_profile
  use table_param,only:add_alloc_event_profile
  use table_param,only:event_profile
  implicit none

  interface
     function reallocEventProfile(p,nold,n)
       use derived,only:EventProfileTable
       type(EventProfileTable),pointer,dimension(:) :: &
            reallocEventProfile,p
       integer,intent(in) :: nold,n
     end function reallocEventProfile
  end interface

  integer,intent(in) :: p
  integer,intent(out) :: n
  integer :: ne

  if (p.gt.total_alloc_event_profile) then
     ne=total_alloc_event_profile+&
          add_alloc_event_profile
     event_profile=>reallocEventProfile(event_profile,&
          total_alloc_event_profile,ne)
     total_alloc_event_profile=ne
  end if

  n=p

  return

end subroutine alloc_profile_table
